package com.example.webbasic.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Redisson配置
 * @author ben
 * @date 2021-11-29 20:56:01 CST
 */
@Configuration
public class RedissonConfig {
	
	@Bean
	public RedissonClient redissonClient() {
		Config cf = new Config();
		// 导致异常
//		cf.useClusterServers()
//		.addNodeAddress("redis://192.168.0.111:6379");
		cf.useSingleServer().setAddress("redis://mylinux:6379");
		
		RedissonClient rc = Redisson.create(cf);
		return rc;
	}

}
